@ECHO OFF
REM ********************************************************************
REM        File: testall.bat
REM Description: Runs test suite under all supported versions of Python
REM              and displays failures when encountered.
REM ********************************************************************

SET GLOBAL_ERRORLEVEL=0

CALL :runCommand "C:\Python33\python.exe -B runtests.py"
CALL :runCommand "C:\Python33\python.exe -B backport.py"
CALL :runCommand "C:\Python27\python.exe -B runtests.py"

IF %GLOBAL_ERRORLEVEL% EQU 0 (
    ECHO.
    ECHO All commands successful.
)
GOTO:EOF

:runCommand
    SETLOCAL & IF %GLOBAL_ERRORLEVEL% NEQ 0 ENDLOCAL & GOTO:EOF
    ECHO.
    ECHO ======================================================================
    ECHO %~1
    ECHO ======================================================================
    CALL %~1
    IF %ERRORLEVEL% NEQ 0 (
        ECHO.
        ECHO Failed Command: %~1
    )
    ENDLOCAL & SET GLOBAL_ERRORLEVEL=%ERRORLEVEL%
    GOTO:EOF
